//
//  main.cpp
//  firstQuestionHere
//
//  Created by 洋犀利 on 2019/8/27.
//  Copyright © 2019 洋犀利. All rights reserved.
//

#include <iostream>
using namespace std;

int main(int argc, const char * argv[]) {
    int need,count,money;
    int pay,less=999999999;
    cin>>need;
    for(int i=0;i<3;i++){
        cin>>count>>money;
        if(need%count==0){
            pay=(need/count)*money;
        }else{
            pay=((need/count)+1)*money;
        }
        if(less>pay)
            less = pay;
    }
    cout<<less;
    
    return 0;
}
